package(default_visibility = ["//tensorflow:internal"])

load(
    "//tensorflow/tensorboard:defs.bzl",
    "tensorboard_ts_development_sources",
    "tensorboard_ts_devserver",
    "tensorboard_ts_library",
    "tensorboard_webcomponent_library",
)

licenses(["notice"])  # Apache 2.0

# TODO(dandelion): Add runner for the test code.

tensorboard_webcomponent_library(
    name = "tf_color_scale",
    srcs = ["tf-color-scale.html"],
    ts_lib_deps = [":ts"],
    deps = [
        "//third_party/javascript/polymer/v1/polymer:lib",
    ],
)

tensorboard_ts_library(
    name = "ts",
    srcs = [
        "colorScale.ts",
        "palettes.ts",
    ],
    deps = ["//tensorflow/tensorboard/components:common_deps_d3v4"],
)

tensorboard_ts_library(
    name = "tests",
    srcs = ["colorScaleTests.ts"],
    deps = [
        ":ts",
        "//tensorflow/tensorboard/components:common_deps_d3v4",
    ],
)

filegroup(
    name = "all_files",
    srcs = glob(["**"]),
    tags = ["notsan"],
)

tensorboard_webcomponent_library(
    name = "demo",
    srcs = ["demo.html"],
    visibility = ["//visibility:public"],
    deps = [
        ":tf_color_scale",
        "//third_party/javascript/polymer/v1/iron-demo-helpers:lib",
        "//third_party/javascript/polymer/v1/paper-button:lib",
        "//third_party/javascript/polymer/v1/paper-styles:lib",
    ],
)

tensorboard_ts_devserver(
    name = "devserver",
    manifest = ":dev_sources",
    serving_path = "/demo_out/bundle.js",
    static_files = [":demo"],
)

tensorboard_ts_development_sources(
    name = "dev_sources",
    deps = [
        ":ts",
    ],
)
